package com.dissertation.model;


import com.dissertation.model.auth.Role;

import javax.validation.constraints.NotNull;
import java.util.*;

/**
 * Created by jsh3 on 17-11-21.
 * 2级目录
 */
public class CategoryLeaf {

    private String categoryLeafName;

    /*只记录表单结构的id*/
//    private String formId;

    @NotNull
    private Set<Role> role = new HashSet<>();

    public String getCategoryLeafName() {
        return categoryLeafName;
    }

    public void setCategoryLeafName( String categoryLeafName ) {
        this.categoryLeafName = categoryLeafName;
    }

    public Set<Role> getRole() {
        return role;
    }

    public void setRole(Set<Role> role) {
        this.role = role;
    }

    public void addRoles( Role... roles ) {
        role = Optional.ofNullable( role ).orElse( new HashSet<>() );
        role.addAll( Arrays.asList( roles ) );
    }
}
